package com.itheima.test.lambda;

import java.util.Random;

public class Lambda03 {
    public static void main(String[] args) {
        useRandomNumHandler(new RandomNumHander() {
            @Override
            public int getNumber() {
                Random r=new Random();
                int num=r.nextInt(10)+1;
                return num;
            }
        });
        System.out.println("------------------------");
        useRandomNumHandler(()->{
            Random random=new Random();
            int num1=random.nextInt(10)+1;
            return num1;
        });
    }
    public static void useRandomNumHandler(RandomNumHander randomNumHander){
        int result = randomNumHander.getNumber();
        System.out.println(result);
    }
}
interface RandomNumHander{
    int getNumber();
}